package com.lsa.helpers;

public class DoubleLinkedList<T> {
	private ListNode<T> head;
	
	public void add(T data) {
		if (head == null) {
			head = new ListNode<T>(data);
		}
		else {
			ListNode<T> newNode = new ListNode<T>(data);
			newNode.prev = head;
			head.next = newNode;
		}
	}
	
	public static class ListNode<T> {
		
		public ListNode(T data) {
			this.data = data;
		}
		
		public T data;
		public ListNode<T> prev;
		public ListNode<T> next;
	}
}